
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class Test {
    public static void main(String[] args) {
        String str = "2022-05-17";
        String[] split = str.split("-");
        int year = Integer.parseInt(split[0]);
        System.out.println(year);
        int month = Integer.parseInt(split[1]);
        System.out.println(month);
        int day = Integer.parseInt(split[2]);
        System.out.println(day);
//        System.out.println(Test.getTime2(year,month,day,3));
        Date time2 = Test.getTime2(year, month, day, 3);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
       System.out.println(format.format(time2));


    }
    public static  Date getTime2(int year,int month,int day,int num){
        Calendar c = Calendar.getInstance();
        c.set(year,month-1,day);
        c.add(Calendar.YEAR,num);
        return c.getTime();
    }
}
